home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Demos / AppMaker 2.0b3 / Demo AppMaker 1.5 / Demo AppMaker™ / Demo AppMaker™.rsrc / TmpP_101_Globals < prev    next >
Encoding:
Text File  |  1992-04-08  |  2.5 KB  |  135 lines

  1. { %filename% }
  2. { Created %date% %time% by AppMaker }
  3.  
  4. Unit %unitname%;
  5. Interface
  6.  
  7. %if lang = MPW%
  8.     Uses
  9.         Types,
  10.         Quickdraw,
  11.         Controls,
  12.         Dialogs,
  13.         Events,
  14.         Lists,
  15.         Menus,
  16.         TextEdit;
  17.  
  18. %end if%
  19. type
  20.     WinInfoRec        = record
  21.       {Standard fields:}
  22.         text:            TEHandle;
  23.         vScroll:        ControlHandle;      
  24.         hScroll:        ControlHandle;      
  25.         fileNum:        integer;             
  26.         volNum:            integer;            
  27.         dirty:            boolean;
  28.         filename:        StringHandle;
  29.         windowKind:        (noWindow%for each window gen windowKind%, fillerWK);
  30.         witlHandle:        Handle;        {Window itemlist resource}
  31.         wictHandle:        Handle;        {Window item color table resource}
  32.         
  33.       {Application-specific fields:}
  34.       %for each window gen windowFields%
  35.  
  36.     end; {WinInfoRec}
  37.     WinInfoPtr        = ^WinInfoRec;
  38.  
  39. type
  40.     SysConfigRec    = record
  41.         hasGestalt:        boolean;
  42.         hasWNE:            boolean;
  43.         hasColorQD:        boolean;
  44.         hasAppleEvents:    boolean;
  45.         hasEditionMgr:    boolean;
  46.     end;
  47.  
  48. var
  49.     quittingTime:    boolean;                             
  50.     curEvent:        EventRecord;                          
  51.     curWindow:        WindowPtr;
  52.     cur:            WinInfoPtr;
  53.     inBackground:    boolean;
  54.     sysConfig:        SysConfigRec;
  55.  
  56. {your application-specific variables:}
  57.  
  58. {----------}
  59. Procedure InitGlobals;
  60. Procedure SetInfo      (window:    WindowPtr);
  61. Procedure SetNewInfo  (window:    WindowPtr);
  62. Procedure DiscardInfo (window:    WindowPtr);
  63.  
  64. {----------}
  65. Implementation
  66.  
  67. %if lang = MPW%
  68.     {$D+}
  69.     {$R+}
  70.     {$OV+}
  71.     {$S %unitname%}
  72.  
  73. %end if%
  74. var
  75.     noCur:            WinInfoRec;
  76.  
  77. {----------}
  78. Procedure InitGlobals;
  79. Begin
  80.     curWindow := nil;
  81.     with noCur do begin
  82.         text := nil;
  83.         vScroll := nil;
  84.         hScroll := nil;
  85.         fileNum := 0;
  86.         volNum := 0;
  87.         dirty := false;
  88.         windowKind := noWindow;
  89.     end; {with}
  90.     cur := @noCur;
  91. End; {InitGlobals}
  92.  
  93. {----------}
  94. Procedure SetInfo        (window:    WindowPtr);
  95. var
  96.     infoPtr:        WinInfoPtr;
  97. Begin
  98.     if window <> curWindow then begin
  99.         curWindow := window;
  100.         if curWindow <> nil then begin
  101.             infoPtr := WinInfoPtr (GetWRefCon (curWindow));
  102.             cur := infoPtr;
  103.         end else begin
  104.             cur := @noCur;
  105.         end;
  106.     end;
  107. End; {SetInfo}
  108.  
  109. {----------}
  110. Procedure SetNewInfo    (window:    WindowPtr);
  111. var
  112.     infoPtr:        WinInfoPtr;
  113. Begin
  114.     infoPtr := WinInfoPtr (NewPtr (sizeof (WinInfoRec)));
  115.     SetWRefCon (window, longint (infoPtr));
  116.     SetInfo (window);
  117. End; {SetNewInfo}
  118.  
  119. {----------}
  120. Procedure DiscardInfo    (window:    WindowPtr);
  121. var
  122.     infoPtr:        WinInfoPtr;
  123. Begin
  124.     if window = curWindow then begin
  125.         SetInfo (nil);
  126.     end;
  127.     infoPtr := WinInfoPtr (GetWRefCon (window));
  128.     DisposPtr (Ptr (infoPtr));
  129.     HideWindow (window);
  130.     DisposeWindow (window);
  131. End; {DiscardInfo}
  132.  
  133. End. {%unitname%}
  134.  
  135.